<include file="Common/common" />

<body>
    <div class="layui-tab-item layui-show">
        <br>
        <div class="layui-main">
            <br>
            <blockquote class="layui-elem-quote">
                <p>注册须知：</p>
                <p>一、请仔细填写账户资料，全球系统统一管理；</p>
                <p>二、如遇申诉需要验证您的手机号码和姓名，请如实填写；</p>
                <p>三、您必须为年满18周岁，55周岁以下完全民事行为能力的合法公民，不符合请勿注册。</p>
            </blockquote>
            <br><br>

            <form class="layui-form" id="register-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">Apk下载</label>
                   <!--  <div class="layui-upload">
                        <a href="http://www.realhahaha.net/shihui.apk" download="shihui.apk" style="color: rgb(240,222,112);background: rgb(57,61,73);font-size: 16px"  type="button" class="layui-btn">立即下载</a>

                    </div> -->
                    <div class="layui-upload-list" style="margin-left: 110px;">
                        <img class="layui-upload-img"  >
                        
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">登录帐号</label>
                    <div class="layui-input-block">
                        <input type="text" name="regAccount" value="" lay-verify="required"  autocomplete="off" placeholder="登录账号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">推荐人账号</label>
                    <div class="layui-input-block">
                        <input type="text" name="topAccount" value="{$topAccount}" lay-verify="required"  autocomplete="off" class="layui-input" disabled="">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">真实姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="truename" value="" lay-verify="required"  autocomplete="off" placeholder="请输入真实姓名" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号码</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" value="" lay-verify="required|phone"  autocomplete="off" placeholder="匹找回密码通知" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">登录密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="password" value="" lay-verify="required"  autocomplete="off" placeholder="登录密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" style="text-overflow:clip;">重复登录密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="confirm_password" value="" lay-verify="required"  autocomplete="off" placeholder="确认登录密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">交易密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="safe_password" value="" lay-verify="required"  autocomplete="off" placeholder="交易密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" style="text-overflow:clip;">重复交易密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="confirm_safe_password" value="" lay-verify="required"  autocomplete="off" placeholder="确认交易密码" class="layui-input">
                    </div>
                </div>
               
                <div class="layui-form-item">

                    <div class="layui-input-block">
                        <input type="checkbox" name="checkedAgreement" id="agree"  lay-skin="primary" title="&nbsp;&nbsp;" checked="">
                        我已完全了解该项目的所有风险，确认自主利用闲散时间、资金参与。
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block" style="margin-left: 105px;">
                        <button class="layui-btn" lay-submit="" lay-filter="btn-register">确认注册</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    
    

    
    

</body>

<script type="text/javascript">
    layui.use(['form'], function(){
        var form = layui.form
        ,layer = layui.layer;

        form.render();

        //监听提交表单
        form.on('submit(btn-register)', function(data){
            var password = data.field.password.trim();
            var confirm_password = data.field.confirm_password.trim();
            var safe_password = data.field.safe_password.trim();
            var confirm_safe_password = data.field.confirm_safe_password.trim();
            var is_agree = $('#agree').is(':checked');
            // console.log(is_agree);

            if ( password != confirm_password ) {
                layer.msg('<span style="color: rgb(240,222,112);">两次登录密码不一致</span>');
                return false;
            }
            if (password.length < 6 || confirm_password.length < 6) {
                layer.msg('<span style="color: rgb(240,222,112);">登录密码长度过短，建议长于>=6</span>');
                return false;
            }

            if ( safe_password != confirm_safe_password ) {
                layer.msg('<span style="color: rgb(240,222,112);">两次交易密码不一致</span>');
                return false;
            }
            if (safe_password.length < 6 || confirm_safe_password.length < 6) {
                layer.msg('<span style="color: rgb(240,222,112);">\'交易密码长度过短，建议长于>=6\'</span>');
                return false;
            }

            if (is_agree == false) {
                layer.msg('请同意！');
                return false;
            }


            layer.confirm('确定要注册会员？',{offset:'none'},function(index){
                $.ajax({
                    type: "post",
                    url: "{:U('Common/ctrl_register')}",
                    data: data.field,
                    dataType: "json",
                    success: function(rtJson){
                        if (rtJson.code == 1) {
                            $('#register-form')[0].reset();//重置表单
                            layer.msg('<span style="color: rgb(240,222,112);">'+rtJson.msg+'</span>');
                        }else{
                            layer.msg('<span style="color: rgb(240,222,112);">'+rtJson.msg+'</span>');
                        }
                    }
                });
            });
            return false;
        });
    });


</script>